package com.assignwork.modules.workarrange;

import com.assignwork.dto.DailyPlanRemarkSubmitDTO;
import com.assignwork.dto.DailySafeInfoSearchDTO;
import com.assignwork.dto.DailySafeInfoSubmitDTO;
import com.assignwork.service.IDailySafeInfoService;
import com.assignwork.vo.DailyPlanRemarkVO;
import com.assignwork.vo.DailySafeInfoVO;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName DailySafeInfoController
 * @Description 每日安全告知控制器
 * @Author dujianyu
 * @Date 2023/12/24 17:29
 */
@RestController
@AllArgsConstructor
@RequestMapping("workArrange/dailySafeInfo")
public class DailySafeInfoController extends BladeController {

    private IDailySafeInfoService service;

    @PostMapping("submit")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "新增或修改", notes = "传入dto")
    public R<Boolean> submitSafeInfo(@RequestBody DailySafeInfoSubmitDTO dto) {
        return R.status(service.submitSafeInfo(dto));
    }

    @GetMapping("/safeInfoByDate")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "信息", notes = "传入planId")
    public R<List<DailySafeInfoVO>> safeInfoByDate(DailySafeInfoSearchDTO dto) {
        return R.data(service.safeInfoByDate(dto));
    }

    @PostMapping("importFromPrevious")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "从之前一天导入", notes = "传入dto")
    public R<Boolean> importFromPrevious(@RequestBody DailySafeInfoSearchDTO dto) {
        return R.status(service.importFromPrevious(dto));
    }

}
